
	/***
	 * class-timer.cpp
	 *
	 * The member functions for class-timer.h
	 *
	 * @author Leigh Ashton <gravious@gmail.com>
	 * @since  2008-07-20
	 **/

	// Required Includes
	#include "class-timer.h"

	// Constructor
	timerObject::timerObject(){

		// Set some basic data to kick start the timer
		fps           = 60;
		currentTime   = setCurrentTime();
		targetTime    = currentTime;
	}

	/***
	 * setCurrentTime()
	 *
	 * Resets the global member field 'currentTime'
	 * to the current amount of milliseconds since
	 * the program started
	 **/

	long double timerObject::setCurrentTime(){

		currentTime = clock();

		return currentTime;
	}

	/***
	 * setTargetTime()
	 *
	 * Creates a trigger point in milliseconds by
	 * adding the fraction of time needed to the 
	 * existing time.
	 **/

	long double timerObject::setTargetTime(){

		targetTime += CLOCKS_PER_SEC / fps;

		return targetTime;
	}

	/***
	 * triggerReached()
	 *
	 * Checks to see if the trigger point has been 
	 * reached or surpassed.  
	 **/

	bool timerObject::triggerReached(){

		if (currentTime >= targetTime){

			return true;
		}else{
			return false;
		}
	}